import { Ast } from '../types';

/**
 * 每一个 Chunk 都对应最终要生成的一个文件
 */
export class Chunk {
  id: string;
  type: ChunkType;
  modules: string[];
  code: string;

  constructor(id: string, type: ChunkType, modules: string[]) {
    this.id = id;
    this.type = type;
    this.modules = modules;
    this.code = '';
  }

  getFileName() {
    return this.type === ChunkType.Js ? 'index.js' : 'index.css';
  }
}

export enum ChunkType {
  Js,
  Css,
}
